#ifndef WF_DRAWLINEBISECTOR_H
#define WF_DRAWLINEBISECTOR_H

#include "pf_previewactioninterface.h"
#include "gui_export.h"

/**
 * This action class can handle user events to draw bisectors.
 *
 */
class GUI_EXPORT WF_DrawLineBisector : public PF_PreviewActionInterface {
	Q_OBJECT
private:
    enum Status {
        SetLine1,     /**< Choose the 1st line. */
        SetLine2,     /**< Choose the 2nd line. */
		SetLength,    /**< Set length in command line. */
		SetNumber     /**< Set number in command line. */
    };

public:
    WF_DrawLineBisector(PF_Container& container,
                              PF_GraphicView& graphicView);
    ~WF_DrawLineBisector() {}

	static QAction* createGUIAction(LX_Define::ActionType /*type*/, QObject* /*parent*/);
	
	virtual LX_Define::ActionType rtti() {
		return LX_Define::ActionDrawLineBisector;
	}

    virtual void trigger();
    virtual void mouseMoveEvent(PF_MouseEvent* e);
    virtual void mouseReleaseEvent(PF_MouseEvent* e);

    virtual void commandEvent(PF_CommandEvent* e);
	virtual PF_StringList getAvailableCommands();
	
    virtual void hideOptions();
    virtual void showOptions();

    virtual void updateMouseButtonHints();
    virtual void updateMouseCursor();
    virtual void updateToolBar();
	
	void setLength(double l) {
		length = l;
	}

	double getLength() {
		return length;
	}
	
	void setNumber(int n) {
		number = n;
	}

	int getNumber() {
		return number;
	}

private:
    /** Closest bisector. */
    PF_Line* bisector;
    /** First chosen entity */
    PF_Line* line1;
    /** Second chosen entity */
    PF_Line* line2;
    /** Data of new bisector */
    PF_LineAttribute data;
    /** Length of the bisector. */
    double length;
	/** Number of bisectors to create. */
	int number;
	/** Mouse pos when choosing the 1st line */
	PF_Vector coord1;
	/** Mouse pos when choosing the 2nd line */
	PF_Vector coord2;
	/** Last status before entering length or number. */
	Status lastStatus;
};

#endif
